package com.example.zhu.Mapper;

import com.example.zhu.dto.Commodity;
import com.example.zhu.dto.MyPage;
import org.apache.ibatis.annotations.*;
import com.example.zhu.dto.Employee;

import java.util.List;

@Mapper
public interface EmployeeMapper {
    @Select("select * from employee order by update_time DESC limit #{min}, #{max}")
    List<Employee> getAllList(MyPage page);
    @Select("select * from employee where name like #{name} order by update_time ")
    List<Employee> getNameList(String name);
    @Select("select * from employee where phone like #{phone} order by update_time ")
    List<Employee> getPhoneList(String phone);
    @Select("select count(id) from employee")
    int getAllListCount();
    @Select("select * from employee where id=#{id}")
    Employee selectById(Employee employee);
    @Update("update employee set name=#{name} , nickname=#{nickname}, id_card=#{idCard},phone=#{phone} , status=#{status}, type=#{type} ,update_time=#{updateTime} WHERE id=#{id} ")
    void updataById(Employee employee);
    @Delete("delete from employee where id=#{id}")
    void Delect(Employee oldEmployee);
    @Insert("insert into employee (name, nickname, id_card,phone, status, type,update_time) VALUES (#{name},#{nickname},#{idCard},#{phone},#{status},#{type},#{updateTime})")
    void Insert(Employee employee);
    @Select("select * from employee where status=#{i}")
    List<Employee> selectByStatus(int i);
    @Select("select * from employee where nickname=#{nickname}")
    Employee selectByNickName(String nickname);
    @Update("update employee set status=#{status}  where nickname=#{nickname}")
    void updataByNickname(String nickname,Integer status);
    @Select("select * from employee")
    List<Employee> selectAll();
}
